<template>
  <div class="seniorschoolSubject">
    <!-- 默认应用列表 -->
    <section
      v-if="!datas.imageList || !datas.imageList[0]"
      :class="[datas.commodityType === 1 ? 'defaultNavigationList1' : '']"
      class="defaultNavigation"
    >
      <div
        v-for="index in 3"
        :key="index"
        class="defaultNavigationList"
        :class="[
          datas.commodityType === 0 ? 'defaultNavigationList0' : '',
          datas.commodityType === 1 ? 'defaultNavigationList1' : '',
          datas.commodityType === 2 ? 'defaultNavigationList2' : '',
          datas.commodityType === 3 ? 'defaultNavigationList3' : '',
          datas.commodityType === 4 ? 'defaultNavigationList4' : '',
        ]"
      >
        <div class="navbg">
          <img v-if="datas.commodityType === 2" draggable="false" src="../../../../assets/images/gzbg1.png" alt="" />
          <img v-else draggable="false" src="../../../../assets/images/gzbg.png" alt="" />
          <!-- 标题 -->
          <div class="subtitle">
            <p>这里显示标题</p>
            <span>这里显示描述，最多显示两行</span>
          </div>
          <!-- 阅读量 -->
          <div class="textnum" v-show="datas.readNumberShow">
            <div class="dianz">
              <span>{{ datas.count }}人已学</span>
            </div>
          </div>
        </div>
      </div>
    </section>

    <!-- 图文样式 -->
    <section
      v-if="datas.imageList || datas.imageList[0]"
      :class="[datas.commodityType === 1 ? 'defaultNavigationList1' : '']"
      class="defaultNavigation"
    >
      <div
        v-for="(item, index) in datas.imageList"
        :key="index"
        class="defaultNavigationList"
        :class="[
          datas.commodityType === 0 ? 'defaultNavigationList0' : '',
          datas.commodityType === 1 ? 'defaultNavigationList1' : '',
          datas.commodityType === 2 ? 'defaultNavigationList2' : '',
          datas.commodityType === 3 ? 'defaultNavigationList3' : '',
          datas.commodityType === 4 ? 'defaultNavigationList4' : '',
        ]"
      >
        <div class="navbg">
          <img
            draggable="false"
            v-if="item.bakcgroundImg"
            :src="item.bakcgroundImg"
            alt=""
          />
          <img
            draggable="false"
            v-else
            src="../../../../assets/images/xueke.png"
            alt=""
          />
          <!-- 标题 -->
          <div class="subtitle">
            <p>{{ item.name }}</p>
            <span>{{ item.desc }}</span>
          </div>
          <!-- 阅读量 -->
          <div class="textnum" v-show="datas.readNumberShow">
            <div class="dianz">
              <span>{{ datas.count }}人已学</span>
            </div>
          </div>
        </div>
      </div>
    </section>
  </div>
</template>
<script>
export default {
  name: "seniorschoolSubject",
  props: {
    datas: Object,
  },
  created() {
    console.log(this.datas, "--------seniorschoolSubject");
  },
};
</script>
<style lang="scss" scope>
.seniorschoolSubject {
  overflow: hidden;
  height: 363px;
  .defaultNavigation {
    padding: 0 15px;
    box-sizing: border-box;
    .defaultNavigationList {
      position: relative;
      /* 一列一个 */
      &.defaultNavigationList0 {
        width: 100%;
        .navbg {
          height: 363px;
          margin-bottom: 20px;
          img {
            width: 100%;
            height: 100%;
          }
          .subtitle {
            position: absolute;
            bottom: 50px;
            left: 0;
            right: 0;
            margin: auto;
            p{
              font-size: 16px;
              font-weight: 600;
              color: #FFFFFF;
            }
            span{
              font-size: 8px;
              font-weight: 400;
              color: #FFFFFF;
            }
          }
          .textnum {
            position: absolute;
            left: 0;
            bottom: -5px;
            width: 100%;
            height: 30px;
            line-height: 30px;
            .dianz {
              font-size: 12px;
              width: 70px;
              height: 25px;
              color: #fff;
              line-height: 25px;
              text-align: left;
              padding-left: 10px;
              background-color: rgba(0, 0, 0, 0.6);
              background: rgba(62, 62, 62, 0.4);
              border-radius: 0px 10px 0px 10px;
            }
          }
        }
      }

      /* 一列两个 */
      &.defaultNavigationList1 {
        width: 100%;
        .navbg {
          height: 168px;
          margin-bottom: 20px;
          img {
            width: 100%;
            height: 100%;
          }
          .subtitle {
            position: absolute;
            bottom: 20px;
            left: 0;
            right: 0;
            margin: auto;
            p{
              font-size: 16px;
              font-weight: 600;
              color: #FFFFFF;
            }
            span{
              font-size: 8px;
              font-weight: 400;
              color: #FFFFFF;
            }
          }
          .textnum {
            position: absolute;
            left: 0;
            bottom: -5px;
            width: 100%;
            height: 30px;
            line-height: 30px;
            .dianz {
              font-size: 12px;
              width: 70px;
              height: 25px;
              color: #fff;
              line-height: 25px;
              text-align: left;
              padding-left: 10px;
              background-color: rgba(0, 0, 0, 0.6);
              background: rgba(62, 62, 62, 0.4);
              border-radius: 0px 10px 0px 10px;
            }
          }
        }
      }

      /* 一列三个 */
      &.defaultNavigationList2 {
        width: 100%;
        .navbg {
          height: 110px;
          margin-bottom: 15px;
          img {
            width: 100%;
            height: 100%;
          }
          .subtitle {
            position: absolute;
            bottom: 30px;
            left: 18px;
            text-align: left;
            p{
              font-size: 16px;
              font-weight: 600;
              color: #FFFFFF;
            }
            span{
              font-size: 8px;
              font-weight: 400;
              color: #FFFFFF;
            }
          }
          .textnum {
            position: absolute;
            left: 0;
            bottom: -5px;
            width: 100%;
            height: 30px;
            line-height: 30px;
            .dianz {
              font-size: 12px;
              width: 70px;
              height: 25px;
              color: #fff;
              line-height: 25px;
              text-align: left;
              padding-left: 10px;
              background-color: rgba(0, 0, 0, 0.6);
              background: rgba(62, 62, 62, 0.4);
              border-radius: 0px 10px 0px 10px;
            }
          }
        }
      }

      /* 一列一个2 */
      &.defaultNavigationList3 {
        width: 100%;
        height: 363px;
        background:#fff;
        border-radius:10px;
        .navbg {
          margin-bottom: 20px;
          height: 260px;
          img {
            width: 100%;
            height: 100%;
          }
          .subtitle {
            p{
              font-size: 16px;
              font-weight: 600;
              color: #333333;
            }
            span{
              font-size: 8px;
              font-weight: 400;
              color:rgba(51, 51, 51, 0.6);
            }
          }
          .textnum {
            position: absolute;
            left: 0;
            bottom: -5px;
            width: 100%;
            height: 30px;
            line-height: 30px;
            .dianz {
              font-size: 12px;
              width: 70px;
              height: 25px;
              color: #fff;
              line-height: 25px;
              text-align: left;
              padding-left: 10px;
              background-color: rgba(0, 0, 0, 0.6);
              background: rgba(62, 62, 62, 0.4);
              border-radius: 0px 10px 0px 10px;
            }
          }
        }
      }

      /* 一列两个2 */
      &.defaultNavigationList4 {
        width: 100%;
        height: 176px;
        background:#fff;
        border-radius:10px;
        margin-bottom:10px;
        .navbg {
          height:104px;
          margin-bottom: 20px;
          img {
            width: 100%;
            height: 100%;
          }
          .subtitle {
            p{
              font-size: 16px;
              font-weight: 600;
              color: #333333;
              // line-height: 5px;
            }
            span{
              font-size: 8px;
              font-weight: 400;
              color:rgba(51, 51, 51, 0.6);
            }
          }
          .textnum {
            position: absolute;
            left: 0;
            bottom: -5px;
            width: 100%;
            height: 30px;
            line-height: 30px;
            .dianz {
              font-size: 12px;
              width: 70px;
              height: 25px;
              color: #fff;
              line-height: 25px;
              text-align: left;
              padding-left: 10px;
              background-color: rgba(0, 0, 0, 0.6);
              background: rgba(62, 62, 62, 0.4);
              border-radius: 0px 10px 0px 10px;
            }
          }
        }
      }
    }
  }
}
</style>
